package org.hxzon.workeasy.service.impl;

import org.hibernate.Hibernate;
import org.hxzon.project.AbstractModelService;
import org.hxzon.util.BitUtil;
import org.hxzon.workeasy.model.EasyPost;
import org.hxzon.workeasy.service.EasyPostService;
import org.springframework.stereotype.Service;

@Service
public class EasyPostServiceImpl extends AbstractModelService<EasyPost> implements EasyPostService {
    public EasyPost findById(String id, int init) {
        EasyPost result = dao.findById(EasyPost.class, id);
        if (result != null) {
            if (BitUtil.isSet(init, Init_Uploads)) {
                Hibernate.initialize(result.getAttachFiles());
            }
            if (BitUtil.isSet(init, Init_Replys)) {
                Hibernate.initialize(result.getReplys());
            }
        }
        return result;
    }
}
